import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        isLogin: false,      
        hotId: '',          //公示Id
        projectState: '',
        searchName:'',
        projectInfo: {},    //登录人项目信息
        userInfo: {},       //登录人信息
        photo: '',
    },
    getters: {

    },
    mutations: {
        //是否登录
        logoutInfo(state,info) {
            state.isLogin = info;
        } ,
        //页面跳转id
        toggleHotId(state,id) {
            var storage=window.localStorage;
            storage.setItem("projectId",id);
            state.hotId = id;
        },
        //查询参数传递
        searchName(state,searchName){
            state.searchName = searchName;
        },
        // 登录人项目信息
        changeProjectInfo(state,info) {
            state.projectInfo = info
        },
        // 登录人信息
        loginUserInfo(state,info) {
            state.userInfo = info
            console.log(info)
        },
        // 项目状态 第几次公示
        changeState(state,info) {
            state.projectState = info
        },
        //登录人头像
        userPhoto(state,info){
            state.photo = info
        }
    },
    actions: {

    }
})

// const store = new Vuex.Store({
//     state: {

//     },
//     getters: {

//     },
//     mutations: {

//     },
//     actions: {

//     }
// });
